import { SAVE_EDIT, SAVE_USER } from '../actionType/profile'

// 初始状态
const initialState = {
  // 基本信息
  user: {},
  profile: {},
}
export const profile = (state = initialState, action) => {
  const { type, payload } = action

  switch (type) {
    // 设置基本信息
    case SAVE_USER:
      return {
        ...state,
        user: { ...payload },
      }
    // 设置个人资料信息（生日）
    case SAVE_EDIT:
      return {
        ...state,
        profile: { ...payload },
      }
    // 默认
    default:
      return state
  }
}
